<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   template="../WEB-INF/shared/masterlayout.xhtml"
   xmlns:c="http://java.sun.com/jstl/core"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:f="http://java.sun.com/jsf/core">
  <ui:define name="leftCol">
    <ui:include src="components/leftCol.xhtml"/>
  </ui:define>
  <ui:define name="rightCol">
      <h:form>
            <h1>Administrera mina bokningar</h1>
            <table class="manageTable">
                <thead>
                    <tr>
                        <td class="dateTime">Datum och tid</td>
                        <td class="fromAirport">Fran Flygplats</td>
                        <td class="toAirport">Till Flygplats</td>
                        <td class="customer">Kund</td>
                        <td class="price">Pris</td>
                        <td class="edit">Radera</td>
                    </tr>
                </thead>
                <tbody>
                    

                    #{ManageReservationsBean.listAllReservations()}

                    <ui:repeat var="reservation" value="#{ManageReservationsBean.reservations}">
                        <tr>
                            <td><h:outputText value="#{reservation.timecreated}"/></td>
                            <td><h:outputText value="#{reservation.reservationPK.fromairport}"/></td>
                            <td><h:outputText value="#{reservation.flight.toairport}"/></td>
                            <td><h:outputText value="#{reservation.reservationPK.customer}"/></td>
                            <td><h:outputText value="#{reservation.flight.price}"/></td>
                            <td>
                                <h:commandLink value="Radera" action="#{ManageReservationsBean.removeReservation}">
                                    <f:setPropertyActionListener target="#{ManageReservationsBean.selectedReservation}" value="#{reservation}"/>
                                </h:commandLink>
                            </td>
                        </tr>
                    </ui:repeat>

                </tbody>
            </table>
        </h:form>
  </ui:define>
</ui:composition>